package controllers

import (
	"github.com/astaxie/beego"
	"travelservia/models"
)

type HomeController struct {
	beego.Controller
}

func (c *HomeController) Prepare()  {
	c.Data["headlink"]="home"
}

func (c *HomeController)Home()  {
	Home_Toutu:=[]models.Home{}
	if err:=models.GetHomeListByType(&Home_Toutu,models.Home_Toutu,1);err!=nil{
		Message_noauto(&c.Controller,`/`,"系统故障","",false)
	}
	c.Data["Home_Toutu"]=&Home_Toutu

	Home_Second_LT:=[]models.Home{}
	if err:=models.GetHomeListByType(&Home_Second_LT,models.Home_Second_LT,1);err!=nil{
		Message_noauto(&c.Controller,"/","系统故障","",false)
	}
	c.Data["Home_Second_LT"]=&Home_Second_LT

	Home_Second_LB:=[]models.Home{}
	if err:=models.GetHomeListByType(&Home_Second_LB,models.Home_Second_LB,2);err!=nil{
		Message_noauto(&c.Controller,"/","系统故障","",false)
	}
	c.Data["Home_Second_LB"]=&Home_Second_LB

	Home_Second_RT:=[]models.Home{}
	if err:=models.GetHomeListByType(&Home_Second_RT,models.Home_Second_RT,1);err!=nil{
		Message_noauto(&c.Controller,"/","系统故障","",false)
	}
	c.Data["Home_Second_RT"]=&Home_Second_RT

	Home_Second_RB:=[]models.Home{}
	if err:=models.GetHomeListByType(&Home_Second_RB,models.Home_Second_RB,2);err!=nil{
		Message_noauto(&c.Controller,"/","系统故障","",false)
	}
	c.Data["Home_Second_RB"]=&Home_Second_RB

	Home_Third:=[]models.Home{}
	if err:=models.GetHomeListByType(&Home_Third,models.Home_Third,1);err!=nil{
		Message_noauto(&c.Controller,"/","系统故障","",false)
	}
	c.Data["Home_Third"]=&Home_Third

	Home_Forth:=[]models.Home{}
	if err:=models.GetHomeListByType(&Home_Forth,models.Home_Forth,1);err!=nil{
		Message_noauto(&c.Controller,"/","系统故障","",false)
	}
	c.Data["Home_Forth"]=&Home_Forth

	Home_Fifth:=[]models.Home{}
	if err:=models.GetHomeListByType(&Home_Fifth,models.Home_Fifth,1);err!=nil{
		Message_noauto(&c.Controller,"/","系统故障","",false)
	}
	c.Data["Home_Fifth"]=&Home_Fifth

	c.TplName="index.html"
}
